@using System.Globalization

<RadzenStack class="rz-p-0 rz-p-md-6 rz-p-lg-12">
    <RadzenCard Variant="Variant.Outlined">
        <RadzenStack Orientation="Orientation.Horizontal" AlignItems="AlignItems.Center" JustifyContent="JustifyContent.Center" Gap="1.5rem" Wrap="FlexWrap.Wrap">
            <RadzenLabel Text="Rotation" Component="rotation" />
            <RadzenSlider @bind-Value="@rotation" Name="rotation" Min="-90" Max="90" />
            <RadzenText>@(rotation)<sup>&deg;</sup></RadzenText>
        </RadzenStack>
    </RadzenCard>

    <RadzenChart>
        <RadzenAreaSeries Smooth="true" Data="@revenue2024" CategoryProperty="Date" Title="2024" ValueProperty="Revenue">
            <RadzenSeriesDataLabels Visible="@showDataLabels" />
        </RadzenAreaSeries>
        <RadzenCategoryAxis Padding="20" LabelRotation="@rotation" />
        <RadzenValueAxis Formatter="@FormatAsUSD">
            <RadzenGridLines Visible="true" />
            <RadzenAxisTitle Text="Revenue in USD" />
        </RadzenValueAxis>
    </RadzenChart>
</RadzenStack>

@code {
    double rotation = -45;
    bool showDataLabels = false;

    class DataItem
    {
        public string Date { get; set; }
        public double Revenue { get; set; }
    }

    string FormatAsUSD(object value)
    {
        return ((double)value).ToString("C0", CultureInfo.CreateSpecificCulture("en-US"));
    }

    DataItem[] revenue2024 = new DataItem[] {
        new DataItem { Date = "January", Revenue = 234000 },
        new DataItem { Date = "February", Revenue = 269000 },
        new DataItem { Date = "March", Revenue = 233000 },
        new DataItem { Date = "April", Revenue = 244000 },
        new DataItem { Date = "May", Revenue = 214000 },
        new DataItem { Date = "June", Revenue = 253000 },
        new DataItem { Date = "July", Revenue = 274000 },
        new DataItem { Date = "August", Revenue = 284000 },
        new DataItem { Date = "September", Revenue = 273000 },
        new DataItem { Date = "October", Revenue = 282000 },
        new DataItem { Date = "November", Revenue = 289000 },
        new DataItem { Date = "December", Revenue = 294000 }
    };
}